package com.group.www.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.group.www.dao.impl.BrandfinancingDao;
import com.group.www.interfaces.BrandfinancingServiceI;
import com.group.www.pojo.Brandfinancing;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@com.alibaba.dubbo.config.annotation.Service
@Service
public class BrandfinancingServiceImp implements BrandfinancingServiceI {
    @Autowired
    private BrandfinancingDao dao;
    @Override
    public boolean add(Brandfinancing brandfinancing) {
        return dao.addBrandfinancing(brandfinancing);
    }
    /**GJ**/
    @Override
    public PageInfo<Brandfinancing> queryAll(int bfId, int pageIndex, int pageSize) {
        /**分页**/
        PageHelper.startPage(pageIndex,pageSize);
        List<Brandfinancing> list= dao.queryAll();
        PageInfo<Brandfinancing> page=new PageInfo<>(list);
        return page;
    }

    @Override
    public Brandfinancing queryById(Integer brandId) {
        return dao.queryById(brandId);
    }

    @Override
    public boolean updateBrand(Brandfinancing brandfinancing) {
        return dao.updateBrand(brandfinancing);
    }

    @Override
    public boolean daleteBrand(Brandfinancing brandfinancing) {
        String id=brandfinancing.getBrand().getBrandid().toString();
        return dao.delete(id);
    }

    @Override
    public boolean daleteMany(String brandIs) {
        return dao.delete(brandIs);
    }
}
